<?php
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
if($_RQ['op']=='list'){
	$pindex = max(1, intval($_RQ['page']));
	$psize = 15;
	$params=array('uniacid'=>$_SESSION['uniacid']);
	if($_RQ['id']){
		$params['zhan_id']=intval($_RQ['id']);
		$return['params']['id']=$_RQ['id'];
	}
	if(!empty($_RQ['merchname'])){
		$params['merchname like']='%'.trim($_RQ['merchname']).'%';
		$return['params']['merchname']=$_RQ['merchname'];
	}
	if(!empty($_RQ['realname'])){
		$params['realname like']='%'.trim($_RQ['realname']).'%';
		$return['params']['realname']=$_RQ['realname'];
	}
	if(!empty($_RQ['mobile'])){
		$params['mobile']=intval($_RQ['mobile']);
		$return['params']['mobile']=$_RQ['mobile'];
	}
	if(isset($_RQ['status'])){
		$params['status']=intval($_RQ['status']);
		$return['params']['status']=$_RQ['status'];
	}
	$fields=array('id','salecate','mobile','realname','status','jointime','accounttime','merchname');
    $orderby='id desc';
	$total='';
	$return['list']=pdo_getslice('jy_merch_user',$params,array($pindex,$psize),$total,$fields,'',$orderby);
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	foreach($return['list'] as &$v){
		$v['jointime']=date('Y/m/d H:i:s',$v['jointime']);
		$v['accounttime']=date('Y/m/d H:i:s',$v['accounttime']);
	}
	$return['status']=array('0'=>array('id'=>0,'title'=>'待入驻'),'1'=>array('id'=>1,'title'=>'入驻中'),'2'=>array('id'=>2,'title'=>'暂停中'));
	$htmls=array(
		'type'=>'list',
		'tabs'=>array(
			array('op'=>'list','title'=>'多商户管理'),
		),
		'list'=>array('data'=>'list','del_one'=>false,'delall'=>false,'edit'=>false,'list'=>array(
			array('name'=>'merchname','title'=>'商户名称','type'=>'string'),
			array('name'=>'salecate','title'=>'主营项目','type'=>'string'),								
			array('name'=>'realname','title'=>'联系人','type'=>'string'),
			array('name'=>'mobile','title'=>'电话','type'=>'string'),									
			array('name'=>'jointime','title'=>'入驻时间','type'=>'string'),
			array('name'=>'accounttime','title'=>'到期时间','type'=>'string'),										
			array('name'=>'status','title'=>'状态','type'=>'radio','options'=>'status2'),	
		),
		),
		'search'=>array(
			array('name'=>'merchname','width'=>15,'title'=>'商户名称','type'=>'string'),
			array('name'=>'realname','width'=>15,'title'=>'姓名','type'=>'string'),
			array('name'=>'mobile','width'=>15,'title'=>'电话','type'=>'string'),
			array('name'=>'status','width'=>15,'title'=>'状态','type'=>'select','options'=>'status'),
		)
	);
	$return['status2']=array('1'=>'入驻中','2'=>'暂停中');
	$return['htmls']=$htmls;
	exi($return);
}
?>